import 'package:flutter/material.dart';

class PageArchive extends StatefulWidget {
  const PageArchive({super.key, required this.data_from_caller});

  final String data_from_caller;

  @override
  State<StatefulWidget> createState() => _PageArchiveState();
}

class _PageArchiveState extends State<PageArchive> {
  @override
  void initState() {
    super.initState();
    print('初始化状态对象');
  }

  @override
  void dispose() {
    super.dispose();
    print('废弃状态对象');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('传递数值到有状态页面'),
      ),
      body: Column(
        children: [
          const Text(
            'Archived stuff',
            style: TextStyle(fontSize: 30),
          ),
          Text(widget.data_from_caller) // 通过 widget 变量来获取【传递到组件的值】
        ],
      ),
    );
  }
}
